package com.naiterui.ehp.bs.doctor.dao.impl;

import com.naiterui.ehp.bp.domain.BannerLabel;
import com.naiterui.ehp.bs.doctor.dao.IBannerLabelDao;
import com.naiterui.ehp.bs.doctor.repository.IBannerLabelRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.stream.Collectors;

@Component
public class AdBannerLabelDaoImpl implements IBannerLabelDao {

    @Autowired
    private IBannerLabelRepository bannerLabelRepository;

    @Override
    public List<Long> getLabelIds(Long bannerId) {
        List<BannerLabel> list = bannerLabelRepository.findByBannerId(bannerId);
        return list.stream().map(BannerLabel::getLabelId).collect(Collectors.toList());
    }

}
